﻿<%@ Page Title="Inventory Control" Language="C#" Culture="auto" UICulture="auto" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="FltInventory.aspx.cs" Inherits="IFD2.FltInventory" %>

<%--<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>--%>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server" role="form" class="form-inline" defaultbutton="lbtnQuery">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div class="container-fluid body-content" style="width:100%;">

    <div class="row">
        <div class="col-sm-2 well well-sm">
            <h5><asp:Literal ID="litTitle" runat="server" meta:resourcekey="tipPageTitle"></asp:Literal></h5>
            <div class="form-group">
                <asp:Label ID="Label1" runat="server" Text="Flight:" meta:resourcekey="Flight"></asp:Label>
                <asp:Label ID="lblAirline" runat="server"></asp:Label>
                <asp:TextBox ID="txtFltNo" runat="server" CssClass="form-control input-sm" Width="100%" MaxLength=4></asp:TextBox>
                <asp:Label ID="Label2" runat="server" Text="Date:" meta:resourcekey="Date"></asp:Label>
                <asp:TextBox ID="txtFltDate" runat="server" CssClass="form-control input-sm" Width="100%" MaxLength=15></asp:TextBox>
            </div>
            <br class="hidden-xs"/><br class="hidden-xs"/>
            <asp:LinkButton ID="lbtnQuery" runat="server" CssClass="form-control input-sm btn-primary text-center" Width="100%" ToolTip="" meta:resourcekey="tipQuery" OnClick="lbtnQuery_Click"> <span class="glyphicon glyphicon-search" style="font-size:large;"></span></asp:LinkButton>
            <p></p><%--没有此行(或&nbsp;)，上面的按钮在手机模式(xs)下，只有上半部可以点击！--%>

            <div class="hidden-xs">
                <div id="myScrollspy" data-spy="affix"><!--data-offset-top="150" data-offset-bottom="100" --><!-- id="myScrollspy"-->
                    <ul class="nav nav-tabs nav-stacked">
                        <li class="active"><a href="#secFltInfo"><asp:Literal ID="Literal6" meta:resourcekey="tipFltInfo" runat="server"></asp:Literal></a></li>
                        <li><a href="#secPrice_n_Sales"><asp:Literal ID="Literal7" meta:resourcekey="tipPrice_n_Sales" runat="server"></asp:Literal></a></li>
                        <li><a href="#secCabinControl"><asp:Literal ID="Literal8" meta:resourcekey="CabinControl" runat="server"></asp:Literal></a></li>
                        <li><a href="#secClassControl"><asp:Literal ID="Literal9" meta:resourcekey="ClassControl" runat="server"></asp:Literal></a></li>
                        <li><a href="#secFlightNotes"><asp:Literal ID="Literal10" meta:resourcekey="FlightNotes" runat="server"></asp:Literal></a></li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="col-sm-10 well well-sm">
            <asp:UpdatePanel ID="UpdatePanel4" runat="server"><ContentTemplate>
                <div class="panel panel-default">
                    <div class="panel-heading btn-primary">
                        <h6 class="panel-title" id="secFltInfo"><!--统一h6,有专用css-->
                        <a data-toggle="collapse"  href="#tipFltInfo">
                            <asp:Literal ID="Literal1" runat="server" meta:resourcekey="tipFltInfo" Text="Table"></asp:Literal>
                            &nbsp;<b class="caret"></b>
                        </a>
                        </h6>
                    </div>
                    <div id="tipFltInfo" class="panel-body panel-collapse collapse in">
                        <div class="table-responsive">
                            <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" CellPadding="4" style="min-width:1200px;width:100%;"
                                DataKeyNames="airline,flt_no,flt_date" DataSourceID="sqlFltInfo" ForeColor="#333333" GridLines="None" >
                                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <Columns>
                                    <asp:TemplateField HeaderText="Flight" meta:resourcekey="Flight1">
                                        <ItemTemplate>
                                            <%# Eval("airline")%> <%#Eval("flt_no") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="status" HeaderText="status" SortExpression="status"  meta:resourcekey="status1" ItemStyle-HorizontalAlign="Center" />
                                    <asp:BoundField DataField="ori_airport" HeaderText="ori_airport" SortExpression="ori_airport"  meta:resourcekey="ori_airport" />
                                    <asp:BoundField DataField="des_airport" HeaderText="des_airport" SortExpression="des_airport"  meta:resourcekey="des_airport" />
                                    <asp:BoundField DataField="dep_time" HeaderText="Dep. Time" SortExpression="dep_time"  meta:resourcekey="dep_time" />
                                    <asp:BoundField DataField="arr_time" HeaderText="Arr. Time" SortExpression="arr_time"  meta:resourcekey="arr_time" />
                                    <asp:BoundField DataField="tail_no" HeaderText="tail_no" SortExpression="tail_no"  meta:resourcekey="tail_no" />
                                    <asp:BoundField DataField="ac_type" HeaderText="ac_type" SortExpression="ac_type"  meta:resourcekey="ac_type" />
                                    <asp:BoundField DataField="surcharge_type" HeaderText="surcharge_type" SortExpression="surcharge_type"  meta:resourcekey="surcharge_type" ItemStyle-HorizontalAlign="Center" />
                                    <asp:CheckBoxField DataField="virtual" HeaderText="virtual" SortExpression="virtual" meta:resourcekey="virtual1" ItemStyle-HorizontalAlign="Center" />
                                    <asp:TemplateField HeaderText="Op. Flight" meta:resourcekey="OpFlight">
                                        <ItemTemplate>
                                            <%# Eval("op_airline")%> <%#Eval("op_flt_no") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="done_user" HeaderText="done_user" SortExpression="done_user"  meta:resourcekey="done_user" />
                                    <asp:BoundField DataField="done_time" HeaderText="done_time" SortExpression="done_time"  meta:resourcekey="done_time" />
                                </Columns>
                                <RowStyle BackColor="#EFF3FB" />
                                <EditRowStyle BackColor="#2461BF" />
                                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <AlternatingRowStyle BackColor="White" />
                            </asp:GridView>
                        </div>
                        <div class="btn-group">
                            <asp:Button ID="btnRoute" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="Route" OnClick="btnRoute_Click" Text="Route..." />
                            <asp:Button ID="btnSaleIndex" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="SaleIndex" OnClick="btnSaleIndex_Click" Text="Sale Index..." />
                            <asp:Button ID="btnLog" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="Logs" OnClick="btnLog_Click" Text="Logs..." />
                            <asp:Button ID="btnRecalculate" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnRecalculate_Click" Text="Re-calculate"  meta:resourcekey="Recalculate"/>
                        </div><br />
                        <div class="btn-group">
                            <asp:Button ID="btnNotPaid" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="UnpaidOrders" OnClick="btnNotPaid_Click" Text="Unpaid Orders..." />
                            <asp:Button ID="btnStandBy" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="StandBy" OnClick="btnStandBy_Click" Text="Stand By..." />
                            <asp:Button ID="btnExpiried" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="ExpiriedOrders" OnClick="btnExpired_Click" Text="Expiried Orders..."  />
                            <asp:Button ID="btnDupOrders" runat="server" CssClass="btn btn-sm btn-default" onclick="btnDupOrders_Click" Text="Duplicate Orders..." meta:resourcekey="DupOrders"/>
                            <asp:Button ID="btnCancelled" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="CancelledOrders" OnClick="btnCancelled_Click" Text="Cancelled..." />
                            <asp:Button ID="btnTickets" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="Tickets" OnClick="btnTickets_Click" Text="Tickets..." />
                        </div><br />
                        <asp:Label ID="lblError2" runat="server" CssClass="ifdMessage"></asp:Label>
                        <%--<div class="well well-sm">
                            <asp:Label ID="Label114" runat="server" meta:resourcekey="Status" Text="Status:"></asp:Label>
                            <asp:DropDownList ID="lstStatus3" runat="server">
                                <asp:ListItem Selected="True" meta:resourcekey="tipSelect" Value="?" Text="Select..."></asp:ListItem>
                                <asp:ListItem meta:resourcekey="Open" Value="O">Open</asp:ListItem>
                                <asp:ListItem meta:resourcekey="Locked" Value="L">Locked</asp:ListItem>
                                <asp:ListItem meta:resourcekey="Cancelled" Value="X">Cancelled</asp:ListItem>
                            </asp:DropDownList>
                            <asp:Button ID="btnSetStatus" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="Set" OnClick="btnSetStatus_Click" Text=" Set " />
                        </div>
                        <div class="well well-sm">
                            <div class="form-group">
                                <asp:Label ID="Label115" runat="server" meta:resourcekey="ChangeAircraft" Text="Change Aircraft:"></asp:Label>
                                <asp:DropDownList ID="lstTailNo" runat="server" DataSourceID="sqlTailNo" DataTextField="tail_no" DataValueField="tail_no"></asp:DropDownList>
                            </div>
                            <asp:Button ID="btnSetTailNo" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="Change" OnClick="btnSetTailNo_Click" Text="Change" /><br />
                            <asp:Label ID="Label117" runat="server" meta:resourcekey="Note" Text="Note: Lock the flight before changing aircraft, and remember to unlock it after changing !" Font-Italic="True"></asp:Label>
                        </div>

                        <div class="well well-sm">
                            <div class="form-group">
                            <asp:Label ID="Label8" runat="server" meta:resourcekey="FltType" Text="Flight Type: "></asp:Label>
                            <asp:DropDownList ID="lstFltTypes" runat="server">
                                <asp:ListItem Selected="True">?</asp:ListItem>
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                                <asp:ListItem>5</asp:ListItem>
                            </asp:DropDownList>
                            </div>
                            <div class="form-group">
                            <asp:Label ID="Label119" runat="server" meta:resourcekey="SurchargeType" Text="Surcharge Type:"></asp:Label>
                            <asp:DropDownList ID="lstSurchargeTypes" runat="server">
                                <asp:ListItem Selected="True">?</asp:ListItem>
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                                <asp:ListItem>5</asp:ListItem>
                                <asp:ListItem>6</asp:ListItem>
                                <asp:ListItem>7</asp:ListItem>
                                <asp:ListItem>8</asp:ListItem>
                                <asp:ListItem>9</asp:ListItem>
                            </asp:DropDownList>
                            </div>
                            <asp:Button ID="btnSetTypes" runat="server" Text="Set" meta:resourcekey="Change" OnClick="btnSetTypes_Click" />
                        </div>--%>
                    </div>
                </div>

                <asp:HiddenField ID="hidFltNo4" runat="server" />
                <asp:HiddenField ID="hidFltDate4" runat="server" />
                <asp:SqlDataSource ID="sqlFltInfo" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:IFD_DB %>" DataSourceMode="DataReader" 
                    SelectCommand="bll_flt_get_root_info" 
                    SelectCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                        <asp:ControlParameter ControlID="hidFltNo4" Name="flt_no" 
                            PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hidFltDate4" Name="flt_date" 
                            PropertyName="Value" Type="DateTime" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sqlTailNo" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:IFD_DB %>" DataSourceMode="DataReader" 
                    SelectCommand="bll_aircraft_get_tail_nos" SelectCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </ContentTemplate></asp:UpdatePanel>
            
            <asp:UpdatePanel ID="UpdatePanel5" runat="server"><ContentTemplate>
                <div class="panel panel-default">
                    <div class="panel-heading btn-primary">
                        <h6 class="panel-title" id="secPrice_n_Sales"><!--统一h6,有专用css-->
                        <a data-toggle="collapse"  href="#tipPrice_n_Sales">
                            <asp:Literal ID="Literal2" runat="server" meta:resourcekey="tipPrice_n_Sales" Text="Table"></asp:Literal>
                            &nbsp;<b class="caret"></b>
                        </a>
                        </h6>
                    </div>
                    <div id="tipPrice_n_Sales" class="panel-body panel-collapse collapse in">
                        <asp:Label ID="Label120" runat="server" Text="Currency:" meta:resourcekey="Currency"></asp:Label>
                        <asp:DropDownList ID="lstCurrencies" runat="server" DataSourceID="sqlCurrencies" DataTextField="code" DataValueField="code"></asp:DropDownList>
                        <asp:Button ID="btnRefreshChart" CssClass="btn btn-sm btn-default" runat="server" Text="Refresh" meta:resourcekey="Refresh" onclick="btnRefreshChart_Click" /><br />
                        <div class="table-responsive">
                            <table><tr><td>
                            <asp:Chart ID="Chart1" runat="server" BackColor="LightSkyBlue" DataSourceID="sqlSaleSituation" Width="1024">
                                <Series>
                                    <asp:Series ChartType="Line" Name="Series1" XValueMember="DBF" IsValueShownAsLabel="true" YAxisType="Primary" XAxisType="Primary" YValueMembers="pax_count" MarkerStyle="Circle" Color="Red" LegendText="PAX"></asp:Series>
                                    <asp:Series ChartType="Line" XValueMember="DBF"  YValueMembers="avg_price" Name="Series2"  IsValueShownAsLabel="true" YAxisType="Secondary" MarkerStyle="Diamond" LegendText="Avg. Price" Color="Goldenrod"></asp:Series>
                                </Series>
                                <ChartAreas>
                                    <asp:ChartArea Name="ChartArea1" ></asp:ChartArea>
                                </ChartAreas>
                            </asp:Chart>
                            </td></tr></table>
                        </div>
                    </div>
                </div>
                <asp:SqlDataSource ID="sqlSaleSituation" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:IFD_DB %>" 
                    SelectCommand="bll_flt_get_sale_situation" SelectCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                        <asp:ControlParameter ControlID="hidFltNo1" Name="flt_no" PropertyName="Value" 
                            Type="String" />
                        <asp:ControlParameter ControlID="hidFltDate1" Name="flt_date" 
                            PropertyName="Value" Type="DateTime" />
                        <asp:ControlParameter ControlID="lstCurrencies" Name="currency" 
                            PropertyName="SelectedValue" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sqlCurrencies" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:IFD_DB %>" 
                    SelectCommand="bll_currency_get_codes" SelectCommandType="StoredProcedure">
                </asp:SqlDataSource>
            </ContentTemplate></asp:UpdatePanel>

            <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
                <div class="panel panel-default">
                    <div class="panel-heading btn-primary">
                        <h6 class="panel-title" id="secCabinControl"><!--统一h6,有专用css-->
                        <a data-toggle="collapse"  href="#CabinControl">
                            <asp:Literal ID="Literal3" runat="server" meta:resourcekey="CabinControl" Text="Table"></asp:Literal>
                            &nbsp;<b class="caret"></b>
                        </a>
                        </h6>
                    </div>
                    <div id="CabinControl" class="panel-body panel-collapse collapse in">
                        <div class="table-responsive">
                            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"  style="min-width:700px;width:100%;" class="table-hover">
                                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <Columns>
                                    <asp:BoundField DataField="airport" HeaderText="airport" SortExpression="airport"  meta:resourcekey="airport" />
                                    <asp:TemplateField HeaderText="cabin" meta:resourcekey="cabin1">
                                        <ItemTemplate>
                                            <input name="KEY1" type="radio" value='<%# Eval("airline")+"|"+Eval("flt_no")+"|"+Eval("flt_date")+"|"+Eval("airport")+"|"+Eval("cabin") %>' />
                                            <%# Eval("cabin") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="cap" HeaderText="cap" SortExpression="cap"  meta:resourcekey="cap" />
                                    <asp:BoundField DataField="cabin_dcp" HeaderText="cabin_dcp" SortExpression="cabin_dcp"  meta:resourcekey="cabin_dcp" Visible="false"/>
                                    <asp:BoundField DataField="max_opn" HeaderText="max_opn" SortExpression="max_opn"  meta:resourcekey="max_opn" />
                                    <asp:BoundField DataField="pending" HeaderText="pending" SortExpression="pending"  meta:resourcekey="pending" />
                                    <asp:BoundField DataField="paid" HeaderText="paid" SortExpression="paid"  meta:resourcekey="paid" />
                                    <asp:BoundField DataField="avail" HeaderText="avail" SortExpression="avail"  meta:resourcekey="avail1" />
                                    <asp:BoundField DataField="done_user" HeaderText="done_user" SortExpression="done_user"  meta:resourcekey="done_user" />
                                    <asp:BoundField DataField="done_time" HeaderText="done_time" SortExpression="done_time"  meta:resourcekey="done_time" />
                                </Columns>
                                <RowStyle BackColor="#EFF3FB" />
                                <EditRowStyle BackColor="#2461BF" />
                                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <AlternatingRowStyle BackColor="White" />
                            </asp:GridView>
                        </div>
                        <asp:Button ID="btnRefresh1" runat="server" CssClass="btn btn-sm btn-default" Text="Refresh" OnClick="btnRefresh1_Click"  meta:resourcekey="Refresh" />
                        <div class="well well-sm">
                            <asp:Label ID="Label102" runat="server" Text="Max Open:" meta:resourcekey="MaxOpen"></asp:Label>
                            <asp:TextBox ID="txtMaxOpen1" runat="server" Width="39px"></asp:TextBox>
                            <asp:Button ID="btnSetMaxOpen1" runat="server" CssClass="btn btn-sm btn-default" Text=" Set " OnClick="btnSetMaxOpen1_Click"  meta:resourcekey="Set" /><br />
                            <asp:Label ID="lblError1" runat="server" CssClass="ifdMessage"></asp:Label>
                            <%--<br />
                            <asp:Label ID="Label105" runat="server" Text="Avail DCP:_X" Visible="False" meta:resourcekey="AvailDCP" Enabled="False"></asp:Label>
                            <asp:DropDownList ID="lstDcps1" runat="server" DataSourceID="SqlDataSource2" DataTextField="dcp_id" DataValueField="dcp_id" Visible="False" Enabled="False"></asp:DropDownList>
                            <asp:Button ID="btnSetDcp1" runat="server" Text="Set DCP" Visible="False"  meta:resourcekey="SetDCP" Enabled="False" />&nbsp;
                            <asp:Button ID="btnClearDcp1" runat="server" Text="Clear DCP" Visible="False"  meta:resourcekey="ClearDCP" Enabled="False" />--%>
                        </div>
                    </div>
                </div>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>" SelectCommand="bll_flt_get_cabin_info" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                        <asp:ControlParameter ControlID="hidFltNo1" Name="flt_no" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hidFltDate1" Name="flt_date" PropertyName="Value" Type="DateTime" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:HiddenField ID="hidFltNo1" runat="server" />
                <asp:HiddenField ID="hidFltDate1" runat="server" />
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="usp_get_cabin_dcp_ids_by_airline" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </ContentTemplate></asp:UpdatePanel>

            <asp:UpdatePanel ID="UpdatePanel2" runat="server"><ContentTemplate>
                <div class="panel panel-default">
                    <div class="panel-heading btn-primary">
                        <h6 class="panel-title" id="secClassControl"><!--统一h6,有专用css-->
                            <a data-toggle="collapse"  href="#ClassControl">
                                <asp:Literal ID="Literal4" runat="server" meta:resourcekey="ClassControl"></asp:Literal>&nbsp;<b class="caret"></b>
                            </a>
                        </h6>
                    </div>
                    <div id="ClassControl" class="panel-body panel-collapse collapse in">
                        <div class="table-responsive">
                            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4" style="min-width:1200px;width:100%;" DataSourceID="SqlDataSource4" ForeColor="#333333" GridLines="None" class="table-hover">
                                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <Columns>
                                    <asp:BoundField DataField="ori_airport" HeaderText="ori_airport" SortExpression="ori_airport"  meta:resourcekey="ori_airport" />
                                    <asp:BoundField DataField="des_airport" HeaderText="des_airport" SortExpression="des_airport"  meta:resourcekey="des_airport" />
                                    <asp:BoundField DataField="cabin" HeaderText="cabin" SortExpression="cabin"  meta:resourcekey="cabin1" />
                                    <asp:TemplateField HeaderText="class" meta:resourcekey="class1">
                                        <ItemTemplate>
                                            <input name="KEY" type="radio" value='<%# Eval("flt_no")+"|"+Eval("flt_date")+"|"+Eval("ori_airport")+"|"+Eval("des_airport")+"|"+Eval("class") %>' />
                                            <%# Eval("class") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="class_sn" HeaderText="class_sn" SortExpression="class_sn"  meta:resourcekey="class_sn" />
                                    <asp:BoundField DataField="market_airline" HeaderText="market_airline" meta:resourceKey="market_airline" SortExpression="market_airline" />
                                    <asp:BoundField DataField="status" HeaderText="status" SortExpression="status"  meta:resourcekey="status1" />
                                    <asp:BoundField DataField="class_dbf" HeaderText="class_dbf" SortExpression="class_dbf"  meta:resourcekey="class_dbf" Visible="false"/>
                                    <asp:BoundField DataField="max_opn" HeaderText="max_opn" SortExpression="max_opn"  meta:resourcekey="max_opn" />
                                    <asp:BoundField DataField="pending" HeaderText="pending" SortExpression="pending"  meta:resourcekey="pending" />
                                    <asp:BoundField DataField="paid" HeaderText="paid" SortExpression="paid"  meta:resourcekey="paid" />
                                    <asp:BoundField DataField="total_avail" HeaderText="total_avail" SortExpression="total_avail"  meta:resourcekey="total_avail" />
                                    <asp:CheckBoxField DataField="nested" HeaderText="nested" SortExpression="nested" meta:resourcekey="nested1"/>
                                    <asp:BoundField DataField="done_user" HeaderText="done_user" SortExpression="done_user"  meta:resourcekey="done_user" />
                                    <asp:BoundField DataField="done_time" HeaderText="done_time" SortExpression="done_time"  meta:resourcekey="done_time" />
                                </Columns>
                                <RowStyle BackColor="#EFF3FB" />
                                <EditRowStyle BackColor="#2461BF" />
                                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <AlternatingRowStyle BackColor="White" />
                            </asp:GridView>
                        </div>
                        <div class="btn-group">
                            <asp:Button ID="btnCalculateAvail" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="CalculateAvail" OnClick="btnCalculateAvail_Click" Text="Calculate Nested Avail." />
                            <asp:Button ID="btnRefresh" runat="server" CssClass="btn btn-sm btn-default" meta:resourcekey="Refresh" OnClick="btnRefresh_Click" Text="Refresh" />
                        </div>
                        <div class="well well-sm">
                            <div class="form-group">
                                <asp:RadioButton ID="radDayOnDay" runat="server" GroupName="radOption"  Checked="True" meta:resourcekey="DayOnDay" Text="DayOnDay"/>
                                <asp:RadioButton ID="radWeekOnWeek" runat="server" GroupName="radOption" meta:resourcekey="WeekOnWeek" Text="WeekOnWeek"/>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="Label17" runat="server" Text="DCP:" meta:resourcekey="DCP"></asp:Label>± 
                                <asp:DropDownList ID="lstSpan" runat="server">
                                    <asp:ListItem Value="0"></asp:ListItem>
                                    <asp:ListItem Value="1"></asp:ListItem>
                                    <asp:ListItem Value="2"></asp:ListItem>
                                    <asp:ListItem Value="3" Selected="True"></asp:ListItem>
                                    <asp:ListItem Value="4"></asp:ListItem>
                                    <asp:ListItem Value="5"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <asp:Button ID="btnDayProductSailing" runat="server" CssClass="btn btn-sm btn-default" Text="Day Product Sailing" meta:resourcekey="DayProductSailing" UseSubmitBehavior="False" />
                        </div>
                        <div class="well well-sm">
                            <div class="btn-group">
                                <asp:Button ID="btnProducts" runat="server" CssClass="btn btn-sm btn-default" Text="Products..." OnClick="btnProducts_Click"  meta:resourcekey="Products"/>
                                <asp:Button ID="btnDelete" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnDelete_Click" Text="Delete"  meta:resourcekey="Delete"/>
                            </div>
                        </div>
                        <asp:Label ID="lblError" runat="server" CssClass="ifdMessage"></asp:Label><br />
                        <div class="well well-sm">
                            <div class="form-group">
                            <asp:Label ID="Label15" runat="server" Text="Class S/N:"  meta:resourcekey="ClassSn"></asp:Label>
                            <asp:TextBox ID="txtClassSn" runat="server" Width="36px"></asp:TextBox>
                            </div>
                            <div class="form-group">
                            <asp:Label ID="Label16" runat="server" ForeColor="Red" meta:resourcekey="MarketAirline" Text="Market Airline:"></asp:Label>
                            <asp:DropDownList ID="lstAirines2" runat="server" DataSourceID="sqlAirlineCodes" DataTextField="code"
                                DataValueField="code" ondatabound="lstAirines2_DataBound">
                            </asp:DropDownList>
                            </div>
                            <div class="form-group">
                            <asp:Label ID="Label12" runat="server" Text="Status:" meta:resourcekey="Status"></asp:Label>
                            &nbsp;<asp:DropDownList
                                ID="lstStatus2" runat="server">
                                <asp:ListItem Selected="True" Value="O" Text="Open" meta:resourcekey="Open"></asp:ListItem>
                                <asp:ListItem Value="R" Text="Request Only" meta:resourcekey="RequestOnly"></asp:ListItem>
                                <asp:ListItem Value="T" meta:resourcekey="TransferIn" Enabled="False">Transfer-in</asp:ListItem>
                                <asp:ListItem Value="B" Text="Blocked" meta:resourcekey="Blocked"></asp:ListItem>
                            </asp:DropDownList>
                            </div>
                            <asp:Button ID="btnSetClassAttributes" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnSetClassAttributes_Click" Text=" Set "  meta:resourcekey="Set"/>
                        </div>
                        <div class="well well-sm">
                            <div class="form-group">
                            <asp:Label ID="Label10" runat="server" Text="Max Open:" meta:resourcekey="MaxOpen"></asp:Label>
                            <asp:TextBox ID="txtMaxOpn2" runat="server" MaxLength="100"></asp:TextBox>
                            </div>
                            <div class="form-group">
                            <asp:CheckBox ID="chkNested" runat="server" Text="Nested" meta:resourcekey="nested" Checked="True"/>
                            </div>
                            <asp:Button ID="btnUpdate" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnUpdate_Click" Text="Set "  meta:resourcekey="Set"/><br />
                            <asp:Label ID="Label118" runat="server" Text="Single:(32);Batch:(ORI-DES/Y:20/Y1:15/Z:10)" meta:resourcekey="tipSetClass" Font-Italic="true"></asp:Label>
                            <asp:CheckBox ID="chkUseDcp2" runat="server" Text="Use DCP:_X" meta:resourcekey="UseDCP" Visible="false" Enabled="False" />
                            <asp:DropDownList ID="lstDcp2" runat="server" DataSourceID="sqlDcps" DataTextField="id" DataValueField="id" Visible="false" Enabled="False"></asp:DropDownList>
                            <asp:Button ID="btnDetails" runat="server" CssClass="btn btn-sm btn-default" Text="Details...X" Enabled="False" meta:resourcekey="Details" OnClick="btnDetails_Click" Visible="false" />
                            <asp:Button ID="btnSetDBF" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnSetDBF_Click" Text="Set_X" meta:resourcekey="Set" Visible="false" Enabled="false" />
                        </div>
                        <div class="well well-sm">
                            <div class="form-group">
                            <asp:Label ID="Label9" runat="server" Text="Segment:" meta:resourcekey="Segment"></asp:Label>
                            <asp:DropDownList ID="lstOri" runat="server" DataSourceID="sqlOrigins" DataTextField="ori_airport" DataValueField="ori_airport"></asp:DropDownList>-
                            <asp:DropDownList ID="lstDes" runat="server" DataSourceID="sqlDestinations" DataTextField="des_airport" DataValueField="des_airport"></asp:DropDownList>
                            </div>
                            <div class="form-group">
                            <asp:Label ID="Label5" runat="server" Text="Cabin:" meta:resourcekey="Cabin"></asp:Label>&nbsp;
                            <asp:DropDownList ID="lstCabins" runat="server" AutoPostBack="True" DataSourceID="sqlCabins" DataTextField="cabin" DataValueField="cabin"></asp:DropDownList>
                            </div>
                            <div class="form-group">
                            <asp:Label ID="Label4" runat="server" Text="Class:" meta:resourcekey="Class"></asp:Label>&nbsp;
                            <asp:DropDownList ID="lstClasses" runat="server" DataSourceID="sqlClasses" DataTextField="class" DataValueField="class"></asp:DropDownList><br />
                            </div>
                            <div class="form-group">
                            <asp:Label ID="Label13" runat="server" meta:resourcekey="MarketAirline" Text="Market Airline:" ForeColor="Red"></asp:Label>&nbsp;
                            <asp:DropDownList ID="lstAirines" runat="server" DataSourceID="sqlAirlineCodes" DataTextField="code" DataValueField="code" ondatabinding="lstAirines_DataBinding"></asp:DropDownList>
                            </div>
                            <div class="form-group">
                            <asp:Label ID="Label6" runat="server" Text="Status:" meta:resourcekey="Status"></asp:Label>
                            <asp:DropDownList ID="lstStatus" runat="server">
                                <asp:ListItem Selected="True" Value="O" Text="Open" meta:resourcekey="Open"></asp:ListItem>
                                <asp:ListItem Value="R" Text="Request Only" meta:resourcekey="RequestOnly"></asp:ListItem>
                                <asp:ListItem Value="T" meta:resourcekey="TransferIn">Transfer-in</asp:ListItem>
                                <asp:ListItem Value="B" Text="Blocked" meta:resourcekey="Blocked"></asp:ListItem>
                            </asp:DropDownList>
                            </div>
                            <div class="form-group">
                            <asp:Label ID="Label7" runat="server" Text="Max Open:" meta:resourcekey="MaxOpen"></asp:Label>
                            <asp:TextBox ID="txtMaxOpn" runat="server" Width="48px"></asp:TextBox>
                            </div>
                            <div class="form-group">
                            <asp:CheckBox ID="chkNested2" runat="server" Text="Nested" meta:resourcekey="nested" Checked="True"/>
                            </div>
                            <asp:CheckBox ID="chkUseDcp" runat="server" Text="Use DCP:" Visible="False" Enabled="False" />
                            <asp:DropDownList ID="lstDcp" runat="server" DataSourceID="sqlDcps" DataTextField="dcp_id" DataValueField="dcp_id" Visible="False" Enabled="False"></asp:DropDownList>
                            <asp:Button ID="btnAdd" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnAdd_Click" Text="Add Class"  meta:resourcekey="AddClass"/>
                        </div>
                    </div>
                </div>

                <asp:HiddenField ID="hidFltNo2" runat="server" />
                <asp:HiddenField ID="hidFltDate2" runat="server" />
                <asp:HiddenField ID="hidAirline" runat="server" />
                <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="bll_flt_get_class_info" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="hidAirline" Name="airline" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hidFltNo2" Name="flt_no" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hidFltDate2" Name="flt_date" PropertyName="Value" Type="DateTime" />
                        <asp:SessionParameter Name="user_airline" SessionField="AIRLINE" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sqlDcps" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="usp_get_class_dbf_ids" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sqlClasses" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="bll_airline_get_class_codes_by_cabin" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                        <asp:ControlParameter ControlID="lstCabins" Name="cabin" PropertyName="SelectedValue"
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sqlCabins" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="bll_flt_get_cabin_codes" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                        <asp:ControlParameter ControlID="hidFltNo2" Name="flt_no" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hidFltDate2" Name="flt_date" PropertyName="Value"
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sqlDestinations" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="bll_flt_get_des_airports" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                        <asp:ControlParameter ControlID="hidFltNo2" Name="flt_no" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hidFltDate2" Name="flt_date" PropertyName="Value"
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sqlOrigins" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="bll_flt_get_ori_airports" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                        <asp:ControlParameter ControlID="hidFltNo2" Name="flt_no" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hidFltDate2" Name="flt_date" PropertyName="Value"
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sqlAirlineCodes" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                    SelectCommand="bll_airline_get_codes" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                </asp:SqlDataSource>
            </ContentTemplate></asp:UpdatePanel>

            

            <asp:UpdatePanel ID="UpdatePanel3" runat="server"><ContentTemplate>
                <div class="panel panel-default">
                    <div class="panel-heading btn-primary">
                        <h6 class="panel-title" id="secFlightNotes"><!--统一h6,有专用css-->
                        <a data-toggle="collapse"  href="#FlightNotes">
                            <asp:Literal ID="Literal5" runat="server" meta:resourcekey="FlightNotes"></asp:Literal>&nbsp;<b class="caret"></b>
                        </a>
                        </h6>
                    </div>
                    <div id="FlightNotes" class="panel-body panel-collapse collapse in">
                        <div class="table-responsive">
                            <asp:GridView ID="gvNotes" runat="server" AutoGenerateColumns="False" style="min-width:700px;width:100%;" class="table-hover" CellPadding="4" DataSourceID="sqlFltNotes" ForeColor="#333333" GridLines="None">
                                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <RowStyle BackColor="#EFF3FB" />
                                <Columns>
                                    <asp:BoundField DataField="note" HeaderText="note" SortExpression="note" meta:resourcekey="note1" />
                                    <asp:BoundField DataField="done_user" HeaderText="done_user" SortExpression="done_user" meta:resourcekey="done_user"/>
                                    <asp:BoundField DataField="done_time" HeaderText="done_time" SortExpression="done_time" meta:resourcekey="done_time"/>
                                </Columns>
                                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <EditRowStyle BackColor="#2461BF" />
                                <AlternatingRowStyle BackColor="White" />
                            </asp:GridView>
                        </div>
                        <div class="well well-sm">
                            <asp:Label ID="Label14" runat="server" Text="New Note:" meta:resourcekey="NewNote"></asp:Label>
                            <asp:TextBox ID="txtNewNote" runat="server" Width="100%"></asp:TextBox>
                            <asp:Button ID="btnAddNote" runat="server" CssClass="btn btn-sm btn-default" Text="Add" OnClick="btnAddNote_Click" meta:resourcekey="Add" />
                            <asp:Button ID="btnRefreshFltNotes" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnRefreshFltNotes_Click" Text="Refresh" meta:resourcekey="Refresh"/><br />
                            <asp:Label ID="lblNoteError" runat="server" CssClass="ifdMessage"></asp:Label>
                        </div>
                    </div>
                </div>
                <asp:SqlDataSource ID="sqlFltNotes" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>" DataSourceMode="DataReader"
                    SelectCommand="bll_flt_get_notes" SelectCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                        <asp:ControlParameter ControlID="hidFltNo3" Name="flt_no" PropertyName="Value" Type="String" />
                        <asp:ControlParameter ControlID="hidFltDate3" Name="flt_date" PropertyName="Value"
                            Type="DateTime" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:HiddenField ID="hidFltNo3" runat="server" />
                <asp:HiddenField ID="hidFltDate3" runat="server" />
            </ContentTemplate></asp:UpdatePanel>

            
        </div>
    </div>

    </div></form>

    <div class="modal fade bs-example-modal-lg" id="modPopup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg"> 
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h6></h6>
                </div>
                <div class="modal-body">
                    <p id="ajaxContent" class="ifdModal">Retrieving...</p>
                </div>
            </div>
        </div>
    </div>

    <script src="JS/ScrollableGridPlugin.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var win_height = parseInt($(window).height());
            var tab_new_height = win_height - 50 - 50;//菜单占50， 表头占50
            if ($('#<%=GridView2.ClientID %>').height() > tab_new_height)
                $('#<%=GridView2.ClientID %>').Scrollable({ ScrollHeight: tab_new_height });
        });
    </script>

    <script type="text/javascript">
  	    //$(document).ready(function() {
  	        //$("#MainContent_txtFltDate1").datepicker({ dateFormat: "yy-mm-dd", numberOfMonths: 2, showButtonPanel: true });
  	        //$("#MainContent_btnDayProductSailing").bind("onclick", "get_ajax()");
  	        //alert("ok");
  	    //});

  	    function get_ajax() {
  	        var flt_no = document.getElementById("MainContent_hidFltNo2").value;
  	        var flt_date = document.getElementById("MainContent_hidFltDate2").value;
  	        var is_week;
  	        if (document.getElementById("MainContent_radWeekOnWeek").checked)
  	            is_week = "1";
  	        else
  	            is_week = "0";
  	        var span = document.getElementById("MainContent_lstSpan").value;
  	        var url = "same_flt_prod_sale_advance.ashx?flt_no=" + flt_no + "&flt_date=" + flt_date + "&weekonweek=" + is_week + "&span=" + span;
  	        //url = "same_flt_prod_sale_advance.ashx?flt_no=3101&flt_date=2018-1-9&weekonweek=0&span=3";
  	        //alert(url);日期格式不能用/，要用-！！！
  	        $('#ajaxContent').load(url);
  	        $('#modPopup').modal('show');
  	    };
  	</script>

</asp:Content>
